package com.ruoyi.rsikManage.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;

import com.ruoyi.rsikManage.domain.TVideoDiagnosticScheme;
import com.ruoyi.rsikManage.service.ITVideoDiagnosticSchemeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 【诊断方案】Controller
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@RestController
@RequestMapping("/riskManage/scheme")
public class TVideoDiagnosticSchemeController extends BaseController
{
    @Autowired
    private ITVideoDiagnosticSchemeService tVideoDiagnosticSchemeService;

    /**
     * 查询【诊断方案】列表
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:scheme:list')")
    @GetMapping("/list")
    public TableDataInfo list(TVideoDiagnosticScheme tVideoDiagnosticScheme)
    {
        startPage();
        List<TVideoDiagnosticScheme> list = tVideoDiagnosticSchemeService.selectTVideoDiagnosticSchemeList(tVideoDiagnosticScheme);
        return getDataTable(list);
    }

    /**
     * 导出【诊断方案】列表
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:scheme:export')")
//    @Log(title = "【诊断方案】", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, TVideoDiagnosticScheme tVideoDiagnosticScheme)
//    {
//        List<TVideoDiagnosticScheme> list = tVideoDiagnosticSchemeService.selectTVideoDiagnosticSchemeList(tVideoDiagnosticScheme);
//        ExcelUtil<TVideoDiagnosticScheme> util = new ExcelUtil<TVideoDiagnosticScheme>(TVideoDiagnosticScheme.class);
//        util.exportExcel(response, list, "【诊断方案】数据");
//    }

    /**
     * 获取【诊断方案】详细信息
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:scheme:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tVideoDiagnosticSchemeService.selectTVideoDiagnosticSchemeById(id));
    }

    /**
     * 新增【诊断方案】
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:scheme:add')")
    @Log(title = "【诊断方案】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TVideoDiagnosticScheme tVideoDiagnosticScheme)
    {
        return toAjax(tVideoDiagnosticSchemeService.insertTVideoDiagnosticScheme(tVideoDiagnosticScheme));
    }

    /**
     * 修改【诊断方案】
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:scheme:edit')")
    @Log(title = "【诊断方案】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TVideoDiagnosticScheme tVideoDiagnosticScheme)
    {
        return toAjax(tVideoDiagnosticSchemeService.updateTVideoDiagnosticScheme(tVideoDiagnosticScheme));
    }

    /**
     * 删除【诊断方案】
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:scheme:remove')")
    @Log(title = "【诊断方案】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tVideoDiagnosticSchemeService.deleteTVideoDiagnosticSchemeByIds(ids));
    }
}
